
#include"Framework.h"
#include"RenderGraph.h"
#include"PassA.h"
#include"PassB.h"
class Test :public Bonnie::Framework {

    ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);

    Bonnie::RenderGraph::SharedPtr mpRG;
    void update(Bonnie::CommandList::SharedPtr pCmd) override {

        ImGui::Begin("Hello, world!");                          // Create a window called "Hello, world!" and append into it.

        ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
        if(ImGui::Button("compiler"))
            mpRG->compile();
        ImGui::End();

        mpRG->RenderUI();
       
        const float clear_color_with_alpha[4] = { clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w };
        pCmd->clearDefaultRTV(clear_color_with_alpha);
    }

    void init() override {
        Framework::init();

        mpRG = Bonnie::RenderGraph::create();
        mpRG->addPass(Bonnie::PassA::creat(),"PassA");
        mpRG->addPass(Bonnie::PassB::creat(),"PassB");
        mpRG->addPass(Bonnie::PassA::creat(), "PassC");
        mpRG->addPass(Bonnie::PassB::creat(), "PassD");
    }
public:
};
// Main code;
int main(int, char**)
{

    Test app;
    app.run();
    return 0;
}


